//
//  ProductImagesCell.swift
//  iWatchManager
//
//  Created by GujyHy on 2018/1/23.
//  Copyright © 2018年 GujyHy. All rights reserved.
//

import UIKit

class ProductImagesCell: UICollectionViewCell {
    
   
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        self.addSubview(self.imageView)
        self.addSubview(self.deleteBtn)
        self.clipsToBounds = true
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
         self.imageView.frame = self.bounds;
         self.deleteBtn.frame = CGRect(x: self.frame.size.width - 36, y: 0,
                                       width: 36, height: 36)
    }
    // MARK: 懒加载
    open lazy var imageView: UIImageView = {
        let imgv = UIImageView()
        imgv.backgroundColor = UIColor(white: 1.0, alpha: 0.5)
        imgv.contentMode = .scaleAspectFit
        return imgv
    } ()
    
    open lazy var deleteBtn: UIButton = {
        let btn = UIButton(type: .custom)
        btn.setImage(UIImage(named:"nookDeleteBtn"), for: .normal)
        btn.imageEdgeInsets = UIEdgeInsetsMake(-10, 0, 0, -10)
        btn.alpha = 1.0
        return btn
    } ()
    
}
